Functions


Functions Summary
bool

cot_config_add(string name, array options, mixed is_module, string category, string donor)

Registers a set of configuration entries at once.

int

cot_config_implant(string module_name, array options, bool into_struct, string donor)

Implants given options into module configuration if they are not already there.

bool

cot_config_implanted(string acceptor, string donor)

Checks if there are already implanted config records

mixed

cot_config_import(string|array name, string source, string filter, string defvalue)

Imports data for config values from outer world

string

cot_config_input(array cfg_var)

Returns config input

array

cot_config_list(string Owner, string Extension, string category, mixed owner, mixed cat, str subcat)

Get configs from database

array

cot_config_load(string name, mixed is_module, string category, string donor)

Loads config structure from database into an array

int

cot_config_modify(string name, array options, mixed is_module, string category, string donor)

Updates config map properties in the database for given options

array

cot_config_parse(array info_cfg)

Parses array of setup file configuration entries into array representation

int

cot_config_remove(string name, mixed is_module, mixed option, string category, string donor)

Unregisters configuration option(s).

int

cot_config_reset(string name, string option, mixed is_module, string category)

Reset configuration value

array

cot_config_selecttitles(string name, array params)

Helper function that generates selection titles.

int

cot_config_set(string name, array options, mixed is_module, string category)

Updates configuration values Example: $config_values = array( 'disable_test' => '0', 'hidden_test' => 'test45', ); cot_config_set('test', $config_values, true);

array

cot_config_titles(string name, string text)

Returns option title and hint

int|NULL

cot_config_type_int_filter(string new_value, array cfg_var, string min, string max, bool skip_warnings)

Filters value as Integer in range from Min and Max.

int

cot_config_update(string name, array options, bool is_module, string category, string donor)

Updates existing configuration map removing obsolete options, adding new options and tweaking options which need to be updated.

boolean|number

cot_config_update_options(string name, array optionslist, mixed is_module, string update_new_only, string source)

Saves updated values of config list in DB

Function Detail

system\configuration.php at line 164

cot_config_add

public bool cot_config_add(string name, array options, mixed is_module, string category, string donor)
Registers a set of configuration entries at once. Example: $config_options = array( array( 'name' => 'disable_test', 'type' => COT_CONFIG_TYPE_RADIO, 'default' => '0' ), array( 'name' => 'test_selection', 'type' => COT_CONFIG_TYPE_SELECT, 'default' => '20', 'variants' => '5,10,15,20,25,30,35,40,50' ), array( 'name' => 'test_value', 'type' => COT_CONFIG_TYPE_STRING, 'default' => 'something' ), array( 'name' => 'not_visible', 'type' => COT_CONFIG_TYPE_HIDDEN, 'default' => 'test23' ) ); cot_config_add('test', $config_options, 'module');
Parameters:
name - Extension name (code)
options - An associative array of configuration entries. Each entry of the array has the following keys: 'name' => Option name, alphanumeric and _. Must be unique for a module/plugin 'type' => Option type, see COT_CONFIG_TYPE_* constants 'default' => Default and initial value, by default is an empty string 'variants' => A comma separated (without spaces) list of possible values, only for SELECT options. 'order' => A string that determines position of the option in the list, e.g. '04'. Or will be assigned automatically if omitted 'text' => Textual description. It is usually omitted and stored in lang files
is_module - Flag indicating if it is module or plugin config
category - Structure category code. Only for per-category config options
donor - Extension name for extension-to-extension config implantations
Returns:
Operation status
Global:
CotDB $db

system\configuration.php at line 219

cot_config_implant

public int cot_config_implant(string module_name, array options, bool into_struct, string donor)
Implants given options into module configuration if they are not already there. Used by plugins which extend module behavior and need per-module or per-category options.
Global:
array $cfg Configuration
Parameters:
module_name - Target module code
options - Array of implantable options, described in cot_config_add()
into_struct - A flag indicating that config options should be implanted into module categories configuration rather than the module root configuration
donor - Extension name for extension-to-extension config implantations
Returns:
Number of options actually implanted
See Also:
cot_config_add()

system\configuration.php at line 244

cot_config_implanted

public bool cot_config_implanted(string acceptor, string donor)
Checks if there are already implanted config records
Parameters:
acceptor - Acceptor module name
donor - Donor extension name
Returns:
TRUE if implanted records found, FALSE if not
Global:
CotDB $db

system\configuration.php at line 719

cot_config_import

public mixed cot_config_import(string|array name, string source, string filter, string defvalue)
Imports data for config values from outer world
Parameters:
name - Name of value or array of names for list of values
source - Source type
filter - Filter type
defvalue - Default value for filtered data
See Also:
cot_import()
Returns:
Filtered value of array of values

system\configuration.php at line 849

cot_config_input

public string cot_config_input(array cfg_var)
Returns config input
Parameters:
cfg_var - Array with config Variable parameters
Returns:

system\configuration.php at line 658

cot_config_list

public array cot_config_list(string Owner, string Extension, string category, mixed owner, mixed cat, str subcat)
Get configs from database
Parameters:
Owner - ('core', 'plug', 'module')
Extension - code (page, forums, etc.) or core subtype (menus, main, performance, etc.)
category - for modules if exists
Returns:

system\configuration.php at line 261

cot_config_load

public array cot_config_load(string name, mixed is_module, string category, string donor)
Loads config structure from database into an array
Parameters:
name - Extension code
is_module - TRUE if module, FALSE if plugin
category - Structure category code. Only for per-category config options
donor - Extension name for extension-to-extension config implantations
Returns:
Config options structure
See Also:
cot_config_add()
Global:
CotDB $db

system\configuration.php at line 305

cot_config_modify

public int cot_config_modify(string name, array options, mixed is_module, string category, string donor)
Updates config map properties in the database for given options
Parameters:
name - Extension code
options - Configuration entries
is_module - TRUE if module, FALSE if plugin
category - Structure category code. Only for per-category config options
donor - Extension name for extension-to-extension config implantations
Returns:
Number of entries updated
Global:
CotDB $db

system\configuration.php at line 348

cot_config_parse

public array cot_config_parse(array info_cfg)
Parses array of setup file configuration entries into array representation
Parameters:
info_cfg - Setup file config entries
Returns:
Config options

system\configuration.php at line 416

cot_config_remove

public int cot_config_remove(string name, mixed is_module, mixed option, string category, string donor)
Unregisters configuration option(s).
Parameters:
name - Extension name (code)
is_module - Flag indicating if it is module or plugin config
option - String name of a single configuration option. Or pass an array of option names to remove them at once. If empty or omitted, all options from selected module/plugin will be removed
category - Structure category code. Only for per-category config options
donor - Extension name for extension-to-extension config implantations
Returns:
Number of options actually removed
Global:
CotDB $db

system\configuration.php at line 629

cot_config_reset

public int cot_config_reset(string name, string option, mixed is_module, string category)
Reset configuration value
Parameters:
name - Extension name config belongs to
option - Option name
is_module - Flag indicating if it is module or plugin config
category - Structure category code. Only for per-category config options
Returns:
Number of entries updated
Global:
CotDB $db

system\configuration.php at line 986

cot_config_selecttitles

public array cot_config_selecttitles(string name, array params)
Helper function that generates selection titles.
Parameters:
name - Current config name
params - Array of config params
Returns:
Selection titles

system\configuration.php at line 485

cot_config_set

public int cot_config_set(string name, array options, mixed is_module, string category)
Updates configuration values Example: $config_values = array( 'disable_test' => '0', 'hidden_test' => 'test45', ); cot_config_set('test', $config_values, true);
Parameters:
name - Extension name config belongs to
options - Array of options as 'option name' => 'option value'
is_module - Flag indicating if it is module or plugin config
category - Structure category code. Only for per-category config options
Returns:
Number of entries updated
Global:
CotDB $db

system\configuration.php at line 965

cot_config_titles

public array cot_config_titles(string name, string text)
Returns option title and hint
Parameters:
name - Config name
text - Config text
Returns:

system\configuration.php at line 85

cot_config_type_int_filter

public int|NULL cot_config_type_int_filter(string new_value, array cfg_var, string min, string max, bool skip_warnings)
Filters value as Integer in range from Min and Max. Used as custom config type callback filter function
See Also:
COT_CONFIG_TYPE_CUSTOM type
Parameters:
new_value - User input value
cfg_var - Config Variable data
min - Minimum allowed value as get from callback parameters
max - Maximum allowed value as get from callback parameters
skip_warnings - Does not display warnings if set
Returns:
Filtered integer value or NULL in case of value can not be filtered / not acceptable

system\configuration.php at line 549

cot_config_update

public int cot_config_update(string name, array options, bool is_module, string category, string donor)
Updates existing configuration map removing obsolete options, adding new options and tweaking options which need to be updated.
Parameters:
name - Extension code
options - Configuration options
is_module - TRUE for modules, FALSE for plugins
category - Structure category code. Only for per-category config options
donor - Extension name for extension-to-extension config implantations
Returns:
Number of entries affected

system\configuration.php at line 769

cot_config_update_options

public boolean|number cot_config_update_options(string name, array optionslist, mixed is_module, string update_new_only, string source)
Saves updated values of config list in DB
Parameters:
name - Extension or Section name config belongs to
optionslist - Option list as return by cot_config_list()
is_module - Flag indicating if it is module or plugin config
update_new_only - Update changes values only
source - Source of imported data
Returns:
Number of updated values